Brushless DC Machines (BLDC) machines are used in all kinds of applications. They evolved from brushed DC machines. These machines work like this.
As the motor turns the brushes (actual mechanical switches) change the direction of the magnetic fields as the rotor turns.
The first brushless variety use electronics to switch in the same way, using Hall effect sensors to detect where to switch. They changed the rotor have permanent magnets instead of vice versa.
Hall effect sensors are based on the Hall effect, where if you have a semiconductor a voltage is induced by the Lorentz force, $\mathbf F = q(\mathbf v \times \mathbf B + \mathbf E)$. They signal a computer or other electronics when the rotor magnet passes by.
Electronic control of the currents in the stator allowed for a lot more control. The idea is that a computer (or other electronics) does the switching. You can use all kinds of different circuits for this, but the most common is an H bridge.
The H bridge is basically switches that are computer controlled. There are three legs on the H bridge above, but it is just an extension of the idea below that allows you to reverse the flow of current through the motor. Here it is shown with all switches open (motor off).
Here it shows how you can send current from left to right.
And here it is sending current the other way.
Below is a two phase motor driven with a simple H bridge as shown above.
Note that driving with DC tends to make the rotation jumpy. The magnetic field is rotating, but not smoothly.
Here is how you can do it with three phases, and the more complicated H bridge shown first.
Note that the motor is still a bit jumpy though probably not as much as before.
Remember when you learned about sine and cosine and the unit circle?
You drive the horizontal axis with a cosine and the vertical axis with a sine you can make a smoothly rotating magnetic field. You can also do the same thing with three phase and this is what is usually used today.
Here is an illustration of how three phases can add to make a smooth rotating magnetic field.
This requires sinewaves not simple on and off waves. The way we do this is to use pulse width modulation (PWM) to make a sinewave. The inductance of the motor smooths (averages) the PWM out.